(function() {
    fetch('http://chst.vip:1234/api/getcoupon').then(body => body.json()).then(res => {
        let result = res.result;
        console.log(result);
        let couponStr = '';
        result.forEach(item => {
            couponStr += `
            <li class="${item.couponId}">
                <a href="../html/couponxq.html?couponid=${item.couponId}">
                    <div class="img">
                        <img src="${item.couponImg}" alt="" >
                    </div>
                    <h2>${item.couponTitle}</h2>
                </a>
            </li>
            `
        });
        $('.coupon').html(couponStr);
    });
    $('.coupon').on('click', 'li', function() {
        location.href = '../html/couponxq.html'
    })
})()